package io.xxx.mario.wechaty.request;

import io.xxx.mario.wechaty.RobotRequest;
import io.xxx.mario.wechaty.response.SendMessageResponse;
import lombok.Data;
import org.springframework.http.HttpMethod;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Data
public class SendMessageRequest implements RobotRequest<SendMessageResponse> {

    private String type = "ROOM";

    private String talkerId;

    private String receiverId;

    private List<Map<String, Object>> messages;

    @Override
    public HttpMethod httpMethod() {
        return HttpMethod.POST;
    }

    @Override
    public String path() {
        return "/message/send";
    }

    @Override
    public Map<String, Object> queryParams() {
        return new HashMap<>() {{
            put("type", type);
            put("id", talkerId);
            put("to", receiverId);
            put("messages", messages);
        }};
    }

    @Override
    public Class<SendMessageResponse> responseType() {
        return SendMessageResponse.class;
    }
}
